<script setup>
  import {ref} from "vue"
  const isShow = ref(true)
</script>

<template>
    <div class="panel">
      <div class="top">
        <span>自由与爱情</span>
        <span @click="isShow = !isShow" style="cursor: pointer;">
          {{ isShow ? "折叠" : "展开" }}
        </span>
      </div>
      <div class="bottom"
      v-show="isShow">
        <p>生命诚可贵，</p>
        <p>自由价更高。</p>
        <p>若为自由故，</p>
        <p>两者皆可抛。</p>
      </div>
    </div>
</template>

<style scoped>
  .top {
    display: flex;
    padding: 2px 4px;
    justify-content: space-between;
    border: 1px solid #ccc;
  }
  .bottom {
    padding: 2px 4px;
    border: 1px solid #ccc;
    border-top: 1px solid transparent;
  }
</style>